package com.ht.web360.base.enums.dto;

import com.ht.web360.base.enums.ObjType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

@Data
@Schema(description = "对象类型传输类")
public class ObjTypeDto {
    @Schema(description = "类型名称")
    String name;
    @Schema(description = "类型简介")
    String description;
    @Schema(description = "类型ContentType")
    String contentType;

    public static ObjTypeDto getInstance(ObjType objType) {
        ObjTypeDto dto = new ObjTypeDto();
        dto.setName(objType.toString());
        dto.setDescription(objType.getDescription());
        dto.setContentType(objType.getValue());
        return dto;
    }

    public ObjType toObjType() {
        return ObjType.valueOf(name);
    }
}
